# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################

FROM gcr.io/oss-fuzz-base/base-builder
RUN git clone --depth 1 https://github.com/abseil/abseil-cpp.git
COPY BUILD WORKSPACE build.sh *_fuzzer.cc $SRC/
RUN chmod +x ./build.sh

# 新增
# ENV FUZZING_LANGUAGE=rust
# WORKDIR /src
# RUN git clone https://oauth2:555a950a06ca2d5b4dc6593637635c7a@gitee.com/xuan34567/pre-fuzz-gini.git
# # 安装依赖
# RUN apt-get update && apt-get install -y curl build-essential pkg-config libssl-dev git clang cmake make llvm liblzma-dev zlib1g-dev

# # 安装 Rust 工具链
# RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# # 添加 cargo 路径
# ENV PATH="/root/.cargo/bin:${PATH}"

# WORKDIR /src/pre-fuzz-gini/fuzzers/inprocess/libfuzzer_libtest

# RUN cargo build --release

# ENV CC=/src/pre-fuzz-gini/fuzzers/inprocess/libfuzzer_libtest/target/release/libafl_cc
# ENV CXX=/src/pre-fuzz-gini/fuzzers/inprocess/libfuzzer_libtest/target/release/libafl_cxx
# ENV LIB_FUZZING_ENGINE=/src/pre-fuzz-gini/fuzzers/inprocess/libfuzzer_libtest/target/release/libfuzzgini.a
# WORKDIR /src/abseil-cpp

# RUN mkdir build && cd build
# RUN cmake cmake -DCMAKE_CXX_COMPILER=clang++ \
#       -DCMAKE_BUILD_TYPE=Release \
#       -DBUILD_SHARED_LIBS=OFF \
#       ..
# RUN make -j$(nproc)